# 在sub_project_one的上级目录运行：docker build -t spo:1.0 -f sub_project_one/Dockerfile ./
# 启动docker容器：docker run -it -p 8000:8000 --name spo spo:1.0
FROM python:3.12-slim

# 设置工作目录
WORKDIR /app

# 安装 Poetry
RUN pip install poetry

# 复制项目文件
COPY sub_project_one  ./sub_project_one
COPY project_utils ./project_utils

# 安装项目依赖
WORKDIR /app/sub_project_one
RUN poetry install --no-root --no-interaction --no-ansi
EXPOSE 8000
# 设置启动命令。 poetry run 确保命令在 Poetry 管理的虚拟环境中执行。无需手动激活虚拟环境。
#CMD ["poetry","run","python", "-m", "src.sub_project_one.module_one"]
CMD ["poetry", "run", "uvicorn", "src.sub_project_one.module_one:app" , "--host", "0.0.0.0", "--port", "8000"]